<?php
session_start();
require("../bin/common.php");
checkSess();
checkInstall();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Patch - Vanadium Patch Mananger</title>
<link href="../lib/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../lib/script.js"></script>
<script type="text/javascript">
function checkField() {
	var correct = 0;
	
	if (document.getElementById("file").value == "") {
		correct++;
		alert("Error: You must input a file.");
	}
	if (document.getElementById("desc").value == "") {
		correct++;
		alert("Error: You must input a description.");
	}
	if (correct == 0) {
		return true;
	}
	else {
		return false;
	}
}
</script>
</head>
<body onload="fixSize()" onresize="fixSize()">

<div class="container" id="container">

	<!-- Header -->
	<div class="top">
	Vanadium Patch Manager

	<?php
	dispLogin();
	?>
	</div>
    
	<!-- Left Hand Panel -->
	<div class="left">
		<br /><span class="nav_option"><img src="../lib/gfx/icon_home.gif" width="15" height="15" alt="Home" /> <a href="../home/">Home</a></span><br /><br />
		<span class="nav_tab_option"><img src="../lib/gfx/icon_add.gif" width="12" height="12" alt="Add" /> <a href="../addpatch/">Add Patch</a></span><br /><br />
		<span class="nav_tab_option"><img src="../lib/gfx/icon_edit.gif" width="13" height="16" alt="Edit" /> <a href="../patch/changelog.php">View Changelog</a></span><br /><br />
		<span class="nav_tab_option"><img src="../lib/gfx/icon_edit.gif" width="13" height="16" alt="Edit" /> <a href="../editpatch/">Edit Patch Home</a></span><br /><br />
		<span class="nav_tab_option"><img src="../lib/gfx/icon_setup.gif" width="14" height="16" alt="Setup" /> <a href="../setup/">Setup</a></span><br /><br />
        <span class="nav_tab_tab_option"><img src="../lib/gfx/icon_edit.gif" width="13" height="16" alt="Edit" /> <a href="../setup/neoncube.php">Neoncube.ini</a></span><br /><br />
        <span class="nav_tab_tab_option"><img src="../lib/gfx/icon_account.gif" width="14" height="14" alt="Accounts" /> <a href="../setup/accounts.php">Accounts</a></span><br /><br />
        <span class="nav_tab_tab_option"><img src="../lib/gfx/icon_cp.gif" width="16" height="16" alt="Control Panel" /> <a href="../setup/cpanel.php">Control Panel</a></span>
	</div>
    
	<!-- Body Content Container -->
	<div class="content_container" id="content_container">
    
		<!--Content Title -->
		<div class="content_title">
			Add Patch
		</div>
        
		<!--Content Body -->
		<div class="content_body">
			To add a new patch, please select the method of upload first:<br /><br />
            
            <!--<img src="../lib/gfx/icon_ftp_upload.gif" width="16" height="16" alt="FTP Upload" /> <a href="index.php?upl=ftp">FTP Upload</a><br /><br />-->
            <img src="../lib/gfx/icon_form_upload.gif" width="16" height="16" alt="Form Upload" /> <a href="index.php?upl=form">Form Upload</a> (Note: Restricted to <b><?php echo ini_get('upload_max_filesize'); ?>B</b>)<br /><br /><br />
            
            <?php
			if ($_GET['upl'] == "form") {
				echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"addform.php\" onsubmit=\"return checkField();\">
            <input type=\"file\" id=\"file\" name=\"patch\" style=\"color: #0a0a0a\" /><br /><br />
            Please describe what the patch will do (for changelog):<br />
            <input name=\"desc\" id=\"desc\" type=\"text\" style=\"color: #0a0a0a\" size=\"70\" />
            <br /><br />
            <input name=\"Submit\" type=\"submit\" value=\"Add Patch\" style=\"color: #0a0a0a\"/>
            </form>";
			}
			
			//Comming soon, i need help with this though, i'm not sure if the file_upload limit from php_ini will negate the upload.
			/*elseif ($_GET['upl'] == "ftp") {
				echo "<form method=\"post\" action=\"addftp.php\">
            <input type=\"file\" id=\"file\" name=\"patch\" style=\"color: #0a0a0a\" /><br /><br />
            Please describe what the patch will do (for changelog):<br />
            <input name=\"desc\" id=\"desc\" type=\"text\" style=\"color: #0a0a0a\" size=\"70\" />
            <br /><br />
            
            FTP Username:<br />
            <input type=\"text\" name=\"ftp_user\" style=\"color: #0a0a0a\" /><br /><br />
            FTP Password:<br />
            <input type=\"password\" name=\"ftp_pass\" style=\"color: #0a0a0a\" /><br /><br />
            FTP Server:<br />
            <input type=\"text\" name=\"ftp_svr\" style=\"color: #0a0a0a\" /><br /><br />
            
            <input name=\"Submit\" type=\"submit\" value=\"Add Patch\" style=\"color: #0a0a0a\"/>
            </form>";
			}*/
			?>
		</div>
    
	<!--End Content Container-->
	</div>
    
	<!--Footer -->
	<div class="footer">
		Vanadium Patch Manager, A Neoncube Patch Modification.<br />
		GNU General Public License v3 - 2010<br />
		http://code.google.com/p/vanadiumpatch/
	</div>

<!--End Container-->
</div>
</body>
</html>